package araujoCoronelVillamayor.plantasVsZombies.uiWicket;

import araujoCoronelVillamayor.plantasVsZombies.appModelsArena.SesionAppModel;
import araujoCoronelVillamayor.plantasVsZombies.domain.Fila;
import araujoCoronelVillamayor.plantasVsZombies.domain.Jardin;
import java.util.ArrayList;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.CompoundPropertyModel;
import org.eclipse.xtext.xbase.lib.Extension;
import org.eclipse.xtext.xbase.lib.Functions.Function0;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.uqbar.wicket.xtend.WicketExtensionFactoryMethods;
import org.uqbar.wicket.xtend.XListView;

@SuppressWarnings("all")
public class EstadoJardinPanel extends Panel {
  @Extension
  private WicketExtensionFactoryMethods _wicketExtensionFactoryMethods = new Function0<WicketExtensionFactoryMethods>() {
    public WicketExtensionFactoryMethods apply() {
      WicketExtensionFactoryMethods _wicketExtensionFactoryMethods = new WicketExtensionFactoryMethods();
      return _wicketExtensionFactoryMethods;
    }
  }.apply();
  
  public EstadoJardinPanel(final String id, final SesionAppModel sesion) {
    super(id);
    CompoundPropertyModel<SesionAppModel> _asCompoundModel = this._wicketExtensionFactoryMethods.<SesionAppModel>asCompoundModel(sesion);
    this.setDefaultModel(_asCompoundModel);
    XListView<Fila> _xListView = new XListView<Fila>("resultados");
    final XListView<Fila> listViewJardin = _xListView;
    Jardin _jardin = sesion.getJardin();
    ArrayList<Fila> _filas = _jardin.getFilas();
    CompoundPropertyModel<ArrayList<Fila>> _asCompoundModel_1 = this._wicketExtensionFactoryMethods.<ArrayList<Fila>>asCompoundModel(_filas);
    listViewJardin.setModel(_asCompoundModel_1);
    final Procedure1<ListItem<Fila>> _function = new Procedure1<ListItem<Fila>>() {
      public void apply(final ListItem<Fila> item) {
        Fila _modelObject = item.getModelObject();
        CompoundPropertyModel<Fila> _asCompoundModel = EstadoJardinPanel.this._wicketExtensionFactoryMethods.<Fila>asCompoundModel(_modelObject);
        item.setModel(_asCompoundModel);
        Label _label = new Label("cantidadPlantas");
        final Label plantasLabel = _label;
        EstadoJardinPanel.this._wicketExtensionFactoryMethods.addChild(item, plantasLabel);
      }
    };
    listViewJardin.setPopulateItem(_function);
    this._wicketExtensionFactoryMethods.addChild(this, listViewJardin);
  }
}
